home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / include / sys / ioctl.h < prev    next >
C/C++ Source or Header  |  1991-06-03  |  13KB  |  315 lines

  1. /*
  2.  * Copyright (c) 1982, 1986 Regents of the University of California.
  3.  * All rights reserved.  The Berkeley software License Agreement
  4.  * specifies the terms and conditions for redistribution.
  5.  *
  6.  *    @(#)ioctl.h    7.6 (Berkeley) 12/18/87
  7.  * $Header: /sprite/src/lib/include/sys/RCS/ioctl.h,v 1.10 91/06/03 17:24:33 kupfer Exp $
  8.  */
  9.  
  10. #ifndef    _IOCTL
  11. #define    _IOCTL
  12.  
  13. #ifndef _TTYCHARS
  14. #include <sys/ttychars.h>
  15. #endif
  16. #ifndef TTYDEV
  17. #include <sys/ttydev.h>
  18. #endif
  19.  
  20. #ifndef _FBDEV
  21. #include <sys/fb.h>
  22. #endif
  23.  
  24. #include <cfuncproto.h>
  25.  
  26. /*
  27.  * Ioctl definitions
  28.  */
  29.  
  30. struct tchars {
  31.     char    t_intrc;    /* interrupt */
  32.     char    t_quitc;    /* quit */
  33.     char    t_startc;    /* start output */
  34.     char    t_stopc;    /* stop output */
  35.     char    t_eofc;        /* end-of-file */
  36.     char    t_brkc;        /* input delimiter (like nl) */
  37. };
  38. struct ltchars {
  39.     char    t_suspc;    /* stop process signal */
  40.     char    t_dsuspc;    /* delayed stop process signal */
  41.     char    t_rprntc;    /* reprint line */
  42.     char    t_flushc;    /* flush output (toggles) */
  43.     char    t_werasc;    /* word erase */
  44.     char    t_lnextc;    /* literal next character */
  45. };
  46.  
  47. /*
  48.  * Structure for TIOCGETP and TIOCSETP ioctls.
  49.  */
  50.  
  51. #ifndef _SGTTYB_
  52. #define    _SGTTYB_
  53. struct sgttyb {
  54.     char    sg_ispeed;        /* input speed */
  55.     char    sg_ospeed;        /* output speed */
  56.     char    sg_erase;        /* erase character */
  57.     char    sg_kill;        /* kill character */
  58.     short    sg_flags;        /* mode flags */
  59. };
  60. #endif
  61.  
  62. /*
  63.  * Window/terminal size structure.
  64.  * This information is stored by the kernel
  65.  * in order to provide a consistent interface,
  66.  * but is not used by the kernel.
  67.  *
  68.  * Type must be "unsigned short" so that types.h not required.
  69.  */
  70. struct winsize {
  71.     unsigned short    ws_row;            /* rows, in characters */
  72.     unsigned short    ws_col;            /* columns, in characters */
  73.     unsigned short    ws_xpixel;        /* horizontal size, pixels */
  74.     unsigned short    ws_ypixel;        /* vertical size, pixels */
  75. };
  76.  
  77. /*
  78.  * Pun for SUN.
  79.  */
  80. struct ttysize {
  81.     unsigned short    ts_lines;
  82.     unsigned short    ts_cols;
  83.     unsigned short    ts_xxx;
  84.     unsigned short    ts_yyy;
  85. };
  86. #define    TIOCGSIZE    TIOCGWINSZ
  87. #define    TIOCSSIZE    TIOCSWINSZ
  88.  
  89. #ifndef _IO
  90. /*
  91.  * Ioctl's have the command encoded in the lower word,
  92.  * and the size of any in or out parameters in the upper
  93.  * word.  The high 3 bits of the upper word are used
  94.  * to encode the in/out status of the parameter.
  95.  */
  96. #define    IOCPARM_MASK    0x1fff        /* parameter length, at most 13 bits */
  97. #define    IOCPARM_LEN(x)    (((x) >> 16) & IOCPARM_MASK)
  98. #define    IOCPARM_MAX    NBPG        /* max size of ioctl, mult. of NBPG */
  99. #define    IOC_VOID    0x20000000    /* no parameters */
  100. #define    IOC_OUT        0x40000000    /* copy out parameters */
  101. #define    IOC_IN        0x80000000    /* copy in parameters */
  102. #define    IOC_INOUT    (IOC_IN|IOC_OUT)
  103. #define    IOC_DIRMASK    0xe0000000    /* mask for IN/OUT/VOID */
  104. /* the 0x20000000 is so we can distinguish new ioctl's from old */
  105. #define    _IO(x,y)    ((int) (IOC_VOID|(x<<8)|y))
  106. #define    _IOR(x,y,t)    ((int) (IOC_OUT|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y))
  107. #define    _IOW(x,y,t)    ((int) (IOC_IN|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y))
  108. /* this should be _IORW, but stdio got there first */
  109. #define    _IOWR(x,y,t)    ((int) (IOC_INOUT|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y))
  110. #endif
  111.  
  112. /*
  113.  * tty ioctl commands
  114.  */
  115. #define    TIOCGETD    _IOR('t', 0, int)        /* get line discipline */
  116. #define    TIOCSETD    _IOW('t', 1, int)        /* set line discipline */
  117. #define    TIOCHPCL    _IO('t', 2)        /* hang up on last close */
  118. #define    TIOCMODG    _IOR('t', 3, int)        /* get modem control state */
  119. #define    TIOCMODS    _IOW('t', 4, int)        /* set modem control state */
  120. #define        TIOCM_LE    0001        /* line enable */
  121. #define        TIOCM_DTR    0002        /* data terminal ready */
  122. #define        TIOCM_RTS    0004        /* request to send */
  123. #define        TIOCM_ST    0010        /* secondary transmit */
  124. #define        TIOCM_SR    0020        /* secondary receive */
  125. #define        TIOCM_CTS    0040        /* clear to send */
  126. #define        TIOCM_CAR    0100        /* carrier detect */
  127. #define        TIOCM_CD    TIOCM_CAR
  128. #define        TIOCM_RNG    0200        /* ring */
  129. #define        TIOCM_RI    TIOCM_RNG
  130. #define        TIOCM_DSR    0400        /* data set ready */
  131. #define    TIOCGETP    _IOR('t', 8,struct sgttyb)/* get parameters -- gtty */
  132. #define    TIOCSETP    _IOW('t', 9,struct sgttyb)/* set parameters -- stty */
  133. #define    TIOCSETN    _IOW('t',10,struct sgttyb)/* as above, but no flushtty */
  134. #define    TIOCEXCL    _IO('t', 13)        /* set exclusive use of tty */
  135. #define    TIOCNXCL    _IO('t', 14)        /* reset exclusive use of tty */
  136. #define    TIOCFLUSH    _IOW('t', 16, int)    /* flush buffers */
  137. #define    TIOCSETC    _IOW('t',17,struct tchars)/* set special characters */
  138. #define    TIOCGETC    _IOR('t',18,struct tchars)/* get special characters */
  139. #define        TANDEM        0x00000001    /* send stopc on out q full */
  140. #define        CBREAK        0x00000002    /* half-cooked mode */
  141. #define        LCASE        0x00000004    /* simulate lower case */
  142. #define        ECHO        0x00000008    /* echo input */
  143. #define        CRMOD        0x00000010    /* map \r to \r\n on output */
  144. #define        RAW        0x00000020    /* no i/o processing */
  145. #define        ODDP        0x00000040    /* get/send odd parity */
  146. #define        EVENP        0x00000080    /* get/send even parity */
  147. #define        ANYP        0x000000c0    /* get any parity/send none */
  148. #define        NLDELAY        0x00000300    /* \n delay */
  149. #define            NL0    0x00000000
  150. #define            NL1    0x00000100    /* tty 37 */
  151. #define            NL2    0x00000200    /* vt05 */
  152. #define            NL3    0x00000300
  153. #define        TBDELAY        0x00000c00    /* horizontal tab delay */
  154. #define            TAB0    0x00000000
  155. #define            TAB1    0x00000400    /* tty 37 */
  156. #define            TAB2    0x00000800
  157. #define        XTABS        0x00000c00    /* expand tabs on output */
  158. #define        CRDELAY        0x00003000    /* \r delay */
  159. #define            CR0    0x00000000
  160. #define            CR1    0x00001000    /* tn 300 */
  161. #define            CR2    0x00002000    /* tty 37 */
  162. #define            CR3    0x00003000    /* concept 100 */
  163. #define        VTDELAY        0x00004000    /* vertical tab delay */
  164. #define            FF0    0x00000000
  165. #define            FF1    0x00004000    /* tty 37 */
  166. #define        BSDELAY        0x00008000    /* \b delay */
  167. #define            BS0    0x00000000
  168. #define            BS1    0x00008000
  169. #define        ALLDELAY    (NLDELAY|TBDELAY|CRDELAY|VTDELAY|BSDELAY)
  170. #define        CRTBS        0x00010000    /* do backspacing for crt */
  171. #define        PRTERA        0x00020000    /* \ ... / erase */
  172. #define        CRTERA        0x00040000    /* " \b " to wipe out char */
  173. #define        TILDE        0x00080000    /* hazeltine tilde kludge */
  174. #define        MDMBUF        0x00100000    /* start/stop output on carrier intr */
  175. #define        LITOUT        0x00200000    /* literal output */
  176. #define        TOSTOP        0x00400000    /* SIGSTOP on background output */
  177. #define        FLUSHO        0x00800000    /* flush output to terminal */
  178. #define        NOHANG        0x01000000    /* no SIGHUP on carrier drop */
  179. #define        L001000        0x02000000
  180. #define        CRTKIL        0x04000000    /* kill line with " \b " */
  181. #define        PASS8        0x08000000
  182. #define        CTLECH        0x10000000    /* echo control chars as ^X */
  183. #define        PENDIN        0x20000000    /* tp->t_rawq needs reread */
  184. #define        DECCTQ        0x40000000    /* only ^Q starts after ^S */
  185. #define        NOFLSH        0x80000000    /* no output flush on signal */
  186. /* locals, from 127 down */
  187. #define    TIOCLBIS    _IOW('t', 127, int)    /* bis local mode bits */
  188. #define    TIOCLBIC    _IOW('t', 126, int)    /* bic local mode bits */
  189. #define    TIOCLSET    _IOW('t', 125, int)    /* set entire local mode word */
  190. #define    TIOCLGET    _IOR('t', 124, int)    /* get local modes */
  191. #define        LCRTBS        (CRTBS>>16)
  192. #define        LPRTERA        (PRTERA>>16)
  193. #define        LCRTERA        (CRTERA>>16)
  194. #define        LTILDE        (TILDE>>16)
  195. #define        LMDMBUF        (MDMBUF>>16)
  196. #define        LLITOUT        (LITOUT>>16)
  197. #define        LTOSTOP        (TOSTOP>>16)
  198. #define        LFLUSHO        (FLUSHO>>16)
  199. #define        LNOHANG        (NOHANG>>16)
  200. #define        LCRTKIL        (CRTKIL>>16)
  201. #define        LPASS8        (PASS8>>16)
  202. #define        LCTLECH        (CTLECH>>16)
  203. #define        LPENDIN        (PENDIN>>16)
  204. #define        LDECCTQ        (DECCTQ>>16)
  205. #define        LNOFLSH        (NOFLSH>>16)
  206. #define    TIOCSBRK    _IO('t', 123)        /* set break bit */
  207. #define    TIOCCBRK    _IO('t', 122)        /* clear break bit */
  208. #define    TIOCSDTR    _IO('t', 121)        /* set data terminal ready */
  209. #define    TIOCCDTR    _IO('t', 120)        /* clear data terminal ready */
  210. #define    TIOCGPGRP    _IOR('t', 119, int)    /* get pgrp of tty */
  211. #define    TIOCSPGRP    _IOW('t', 118, int)    /* set pgrp of tty */
  212. #define    TIOCSLTC    _IOW('t',117,struct ltchars)/* set local special chars */
  213. #define    TIOCGLTC    _IOR('t',116,struct ltchars)/* get local special chars */
  214. #define    TIOCOUTQ    _IOR('t', 115, int)    /* output queue size */
  215. #define    TIOCSTI        _IOW('t', 114, char)    /* simulate terminal input */
  216. #define    TIOCNOTTY    _IO('t', 113)        /* void tty association */
  217. #define    TIOCPKT        _IOW('t', 112, int)    /* pty: set/clear packet mode */
  218. #define        TIOCPKT_DATA        0x00    /* data packet */
  219. #define        TIOCPKT_FLUSHREAD    0x01    /* flush packet */
  220. #define        TIOCPKT_FLUSHWRITE    0x02    /* flush packet */
  221. #define        TIOCPKT_STOP        0x04    /* stop output */
  222. #define        TIOCPKT_START        0x08    /* start output */
  223. #define        TIOCPKT_NOSTOP        0x10    /* no more ^S, ^Q */
  224. #define        TIOCPKT_DOSTOP        0x20    /* now do ^S ^Q */
  225. #define    TIOCSTOP    _IO('t', 111)        /* stop output, like ^S */
  226. #define    TIOCSTART    _IO('t', 110)        /* start output, like ^Q */
  227. #define    TIOCMSET    _IOW('t', 109, int)    /* set all modem bits */
  228. #define    TIOCMBIS    _IOW('t', 108, int)    /* bis modem bits */
  229. #define    TIOCMBIC    _IOW('t', 107, int)    /* bic modem bits */
  230. #define    TIOCMGET    _IOR('t', 106, int)    /* get all modem bits */
  231. #define    TIOCREMOTE    _IOW('t', 105, int)    /* remote input editing */
  232. #define    TIOCGWINSZ    _IOR('t', 104, struct winsize)    /* get window size */
  233. #define    TIOCSWINSZ    _IOW('t', 103, struct winsize)    /* set window size */
  234. #define    TIOCUCNTL    _IOW('t', 102, int)    /* pty: set/clr usr cntl mode */
  235. #define        UIOCCMD(n)    _IO('u', n)        /* usr cntl op "n" */
  236. #define    TIOCCONS    _IO('t', 98)        /* become virtual console */
  237.  
  238. #define    OTTYDISC    0        /* old, v7 std tty driver */
  239. #define    NETLDISC    1        /* line discip for berk net */
  240. #define    NTTYDISC    2        /* new tty discipline */
  241. #define    TABLDISC    3        /* tablet discipline */
  242. #define    SLIPDISC    4        /* serial IP discipline */
  243.  
  244. #define    FIOCLEX        _IO('f', 1)        /* set close on exec on fd */
  245. #define    FIONCLEX    _IO('f', 2)        /* remove close on exec */
  246. /* another local */
  247. #define    FIONREAD    _IOR('f', 127, int)    /* get # bytes to read */
  248. #define    FIONBIO        _IOW('f', 126, int)    /* set/clear non-blocking i/o */
  249. #define    FIOASYNC    _IOW('f', 125, int)    /* set/clear async i/o */
  250. #define    FIOSETOWN    _IOW('f', 124, int)    /* set owner */
  251. #define    FIOGETOWN    _IOR('f', 123, int)    /* get owner */
  252.  
  253. /* socket i/o controls */
  254. #define    SIOCSHIWAT    _IOW('s',  0, int)        /* set high watermark */
  255. #define    SIOCGHIWAT    _IOR('s',  1, int)        /* get high watermark */
  256. #define    SIOCSLOWAT    _IOW('s',  2, int)        /* set low watermark */
  257. #define    SIOCGLOWAT    _IOR('s',  3, int)        /* get low watermark */
  258. #define    SIOCATMARK    _IOR('s',  7, int)        /* at oob mark? */
  259. #define    SIOCSPGRP    _IOW('s',  8, int)        /* set process group */
  260. #define    SIOCGPGRP    _IOR('s',  9, int)        /* get process group */
  261.  
  262. #define    SIOCADDRT    _IOW('r', 10, struct rtentry)    /* add route */
  263. #define    SIOCDELRT    _IOW('r', 11, struct rtentry)    /* delete route */
  264.  
  265. #define    SIOCSIFADDR    _IOW('i', 12, struct ifreq)    /* set ifnet address */
  266. #define    SIOCGIFADDR    _IOWR('i',13, struct ifreq)    /* get ifnet address */
  267. #define    SIOCSIFDSTADDR    _IOW('i', 14, struct ifreq)    /* set p-p address */
  268. #define    SIOCGIFDSTADDR    _IOWR('i',15, struct ifreq)    /* get p-p address */
  269. #define    SIOCSIFFLAGS    _IOW('i', 16, struct ifreq)    /* set ifnet flags */
  270. #define    SIOCGIFFLAGS    _IOWR('i',17, struct ifreq)    /* get ifnet flags */
  271. #define    SIOCGIFBRDADDR    _IOWR('i',18, struct ifreq)    /* get broadcast addr */
  272. #define    SIOCSIFBRDADDR    _IOW('i',19, struct ifreq)    /* set broadcast addr */
  273. #define    SIOCGIFCONF    _IOWR('i',20, struct ifconf)    /* get ifnet list */
  274. #define    SIOCGIFNETMASK    _IOWR('i',21, struct ifreq)    /* get net addr mask */
  275. #define    SIOCSIFNETMASK    _IOW('i',22, struct ifreq)    /* set net addr mask */
  276. #define    SIOCGIFMETRIC    _IOWR('i',23, struct ifreq)    /* get IF metric */
  277. #define    SIOCSIFMETRIC    _IOW('i',24, struct ifreq)    /* set IF metric */
  278. #define SIOCRPHYSADDR   _IOWR('i',28, struct ifdevea)   /* Read phys. 
  279.                              * enet addr.*/
  280. #define    SIOCSARP    _IOW('i', 30, struct arpreq)    /* set arp entry */
  281. #define    SIOCGARP    _IOWR('i',31, struct arpreq)    /* get arp entry */
  282. #define    SIOCDARP    _IOW('i', 32, struct arpreq)    /* delete arp entry */
  283.  
  284. /* Graphics io controls for Ultrix on the DECStation 3100. */
  285. #define QIOCGINFO     _IOR('q', 1, DevScreenInfo *)    /* get the info     */
  286. #define QIOCPMSTATE    _IOW('q', 2, DevCursor)    /* set mouse pos */
  287. #define    QIOWCURSORCOLOR    _IOW('q', 3, unsigned int [6])    /* bg/fg r/g/b */
  288. #define QIOCINIT    _IO('q', 4)            /* init screen   */
  289. #define QIOCKPCMD    _IOW('q', 5, DevKpCmd)    /* keybd. per. cmd */
  290. #define QIOCADDR    _IOR('q', 6, DevScreenInfo *)    /* get address */
  291. #define    QIOWCURSOR    _IOW('q', 7, short[32])    /* write cursor bit map */
  292. #define QIOKERNLOOP    _IO('q', 8)   /*re-route kernel console output */
  293. #define QIOKERNUNLOOP    _IO('q', 9)   /*don't re-route kernel console output */
  294. #define QIOVIDEOON    _IO('q', 10)            /* turn on the video */
  295. #define    QIOVIDEOOFF    _IO('q', 11)            /* turn off the video */
  296. #define QIOSETCMAP      _IOW('q', 12, DevColorMap)
  297. #define QIOISCOLOR    _IOR('q', 13, int)    /* is it a color device? */
  298.  
  299. /* Graphics io controls for Sun frame buffers. */
  300. #define FBIOGTYPE _IOR('F', 0, struct fbtype)        /* get description */
  301. #define FBIOGPIXRECT _IOWR('F', 1, struct fbpixrect)    /* get pixrect */
  302. #define FBIOGINFO _IOR('F', 2, struct fbinfo)        /* get other info */
  303. #define FBIOPUTCMAP _IOW('F', 3, struct fbcmap)        /* set cmap */
  304. #define FBIOGETCMAP _IOW('F', 4, struct fbcmap)        /* get cmap */
  305. #define FBIOSATTR       _IOW('F', 5, struct fbsattr)    /* set attrs */
  306. #define FBIOGATTR       _IOR('F', 6, struct fbgattr)    /* get attrs */
  307. #define FBIOSVIDEO      _IOW('F', 7, int)        /* video control */
  308. #define FBIOGVIDEO      _IOR('F', 8, int)        /* video control */
  309. #define FBIOVERTICAL    _IOW('F', 9, int)        /* vert. retrace */
  310.  
  311.  
  312. extern int ioctl _ARGS_((int fd, unsigned long cmd, ...));
  313.  
  314. #endif _IOCTL
  315.